<template>
    <div>
        <van-row>
            <van-cell-group>
                <van-field v-model="value" label="文本" placeholder="请输入用户名" />
            </van-cell-group>
            <van-button >nihao </van-button>
        </van-row>
        <van-row>
            <van-button @click="dianji">子页面</van-button>
        </van-row>
        <van-row>
            <van-button >子页面</van-button>
        </van-row> <van-row>
        <van-button >子页面</van-button>
    </van-row> <van-row>
        <van-button >子页面</van-button>
    </van-row> <van-row>
        <van-button >子页面</van-button>
    </van-row> <van-row>
        <van-button >子页面</van-button>
    </van-row>
        <van-row>
            <van-button >子页面</van-button>
        </van-row>
        <van-row>
            <van-button >子页面</van-button>
        </van-row>
        <van-row>
            <van-button >子页面</van-button>
        </van-row>
        <van-row>
            <van-button >子页面</van-button>
        </van-row>
        <van-row>
            <van-button >子页面</van-button>
        </van-row>
        <van-row>
            <van-button >子页面</van-button>
        </van-row>
        <van-row>
            <van-button >子页面</van-button>
        </van-row>
        <van-row>
            <van-button >子页面</van-button>
        </van-row>
        <van-row>
            <van-button >nihao </van-button>
        </van-row>
        <van-row>
            <van-button >nihao </van-button>
        </van-row>
        <van-row>
            <van-button >nihao </van-button>
        </van-row>  <van-row>
        <van-button >nihao </van-button>
    </van-row>  <van-row>
        <van-button >子页面啦 </van-button>
    </van-row>



    </div>
</template>

<script>
    export default {
        name: "detail",
        data(){
            return{
                value:'',
            }
        },
        beforeRouteLeave:(to,from,next)=>{
            console.log(to.name)
            if (to.name=='detailto'){
                if (!from.meta.keepAlive){
                    from.meta.keepAlive=true
                }
                next()
            }else{
                from.meta.keepAlive=false
                to.meta.keepAlive=false
                next()
            }
        },
        methods:{
            dianji(){
                this.$router.push('/detailto')
            }
        }
    }
</script>

<style scoped>

</style>
